﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using java.util;

namespace Game.templates.item
{
    public class ExItemType
    {
        public static int WEAPON_MASK = 0;
	    public static int ARMOR_MASK = 1;
	    public static int ACCESSORIES_MASK = 2;
	    public static int SUPPLIES_MASK = 3;
	    public static int PET_GOODS_MASK = 4;
	    public static int ETC_MASK = 5;
	    private int mask;
        private int num;
        ExItemType(int num,int mask)
        {
            this.num = num;
            this.mask = mask;
        }
        public int getMask()
        {
            return mask;
        }
        public int getNum()
        {
            return num;
        }
        public static ExItemType[] getTypesForMask(int mask)
	    {
		    if ((mask < WEAPON_MASK) && (mask > ETC_MASK))
		    {
			    return new ExItemType[0];
		    }
		    List list = new ArrayList();
		    foreach (var exType in Values.Where(exType => exType.getMask() == mask))
		    {
		        list.add(exType);
		    }
		    return (ExItemType[]) list.toArray(new ExItemType[list.size()]);
	    }
        public static readonly ExItemType EMPTY0=new ExItemType(0,0);
        public static readonly ExItemType SWORD = new ExItemType(1, 0);
        public static readonly ExItemType MAGIC_SWORD = new ExItemType(2,0);
        public static readonly ExItemType DAGGER = new ExItemType(3,0);
        public static readonly ExItemType RAPIER = new ExItemType(4,0);
        public static readonly ExItemType BIG_SWORD = new ExItemType(5,0);
        public static readonly ExItemType ANCIENT_SWORD = new ExItemType(6,0);
        public static readonly ExItemType DUAL_SWORD = new ExItemType(7,0);
        public static readonly ExItemType DUAL_DAGGER = new ExItemType(8,0);
        public static readonly ExItemType BLUNT_WEAPON = new ExItemType(9,0);
        public static readonly ExItemType MAGIC_BLUNT_WEAPON = new ExItemType(10,0);
        public static readonly ExItemType BIG_BLUNT_WEAPON = new ExItemType(11,0);
        public static readonly ExItemType BIG_MAGIC_BLUNT_WEAPON = new ExItemType(12,0);
        public static readonly ExItemType DUAL_BLUNT_WEAPON = new ExItemType(13,0);
        public static readonly ExItemType BOW = new ExItemType(14,0);
        public static readonly ExItemType CROSSBOW = new ExItemType(15,0);
        public static readonly ExItemType HAND_TO_HAND = new ExItemType(16,0);
        public static readonly ExItemType POLE = new ExItemType(17,0);
        public static readonly ExItemType OTHER_WEAPON = new ExItemType(18,0);
        public static readonly ExItemType HELMET = new ExItemType(19,1);
        public static readonly ExItemType UPPER_PIECE = new ExItemType(20,1);
        public static readonly ExItemType LOWER_PIECE = new ExItemType(21,1);
        public static readonly ExItemType FULL_BODY = new ExItemType(22,1);
        public static readonly ExItemType GLOVES = new ExItemType(23,1);
        public static readonly ExItemType FEET = new ExItemType(24,1);
        public static readonly ExItemType SHIELD = new ExItemType(25,1);
        public static readonly ExItemType SIGIL = new ExItemType(26,1);
        public static readonly ExItemType UNDERWEAR = new ExItemType(27,1);
        public static readonly ExItemType CLOAK = new ExItemType(28, 1);
        public static readonly ExItemType RING = new ExItemType(29, 2);
        public static readonly ExItemType EARRING = new ExItemType(30,2);
        public static readonly ExItemType NECKLACE = new ExItemType(31,2);
        public static readonly ExItemType BELT = new ExItemType(32,2);
        public static readonly ExItemType BRACELET = new ExItemType(33,2);
        public static readonly ExItemType HAIR_ACCESSORY = new ExItemType(34,2);
        public static readonly ExItemType POTION = new ExItemType(35,3);
        public static readonly ExItemType SCROLL_ENCHANT_WEAPON = new ExItemType(36,3);
        public static readonly ExItemType SCROLL_ENCHANT_ARMOR = new ExItemType(37,3);
        public static readonly ExItemType SCROLL_OTHER = new ExItemType(38,3);
        public static readonly ExItemType SOULSHOT = new ExItemType(39,3);
        public static readonly ExItemType SPIRITSHOT = new ExItemType(40,3);
        public static readonly ExItemType EMPTY41 = new ExItemType(41,3);
        public static readonly ExItemType PET_EQUIPMENT = new ExItemType(42,4);
        public static readonly ExItemType PET_SUPPLIES = new ExItemType(43,4);
        public static readonly ExItemType CRYSTAL = new ExItemType(44,5);
        public static readonly ExItemType RECIPE = new ExItemType(45,5);
        public static readonly ExItemType CRAFTING_MAIN_INGRIDIENTS = new ExItemType(46,5);
        public static readonly ExItemType LIFE_STONE = new ExItemType(47,5);
        public static readonly ExItemType SOUL_CRYSTAL = new ExItemType(48,5);
        public static readonly ExItemType ATTRIBUTE_STONE = new ExItemType(49,5);
        public static readonly ExItemType WEAPON_ENCHANT_STONE = new ExItemType(50,5);
        public static readonly ExItemType ARMOR_ENCHANT_STONE = new ExItemType(51,5);
        public static readonly ExItemType SPELLBOOK = new ExItemType(52,5);
        public static readonly ExItemType GEMSTONE = new ExItemType(53,5);
        public static readonly ExItemType POUCH = new ExItemType(54,5);
        public static readonly ExItemType PIN = new ExItemType(55,5);
        public static readonly ExItemType MAGIC_RUNE_CLIP = new ExItemType(56,5);
        public static readonly ExItemType MAGIC_ORNAMENT = new ExItemType(57,5);
        public static readonly ExItemType DYES = new ExItemType(58,5);
        public static readonly ExItemType OTHER_ITEMS = new ExItemType(59,5);
        public static IEnumerable<ExItemType> Values
        {
            get
            {
                yield return EMPTY0;
                yield return SWORD;
                yield return MAGIC_SWORD;
                yield return DAGGER;
                yield return RAPIER;
                yield return BIG_SWORD;
                yield return ANCIENT_SWORD;
                yield return DUAL_SWORD;
                yield return DUAL_DAGGER;
                yield return BLUNT_WEAPON;
                yield return MAGIC_BLUNT_WEAPON;
                yield return BIG_BLUNT_WEAPON;
                yield return BIG_MAGIC_BLUNT_WEAPON;
                yield return  DUAL_BLUNT_WEAPON;
                yield return BOW;
                yield return CROSSBOW;
                yield return HAND_TO_HAND;
                yield return POLE;
                yield return OTHER_WEAPON;
                yield return HELMET;
                yield return UPPER_PIECE;
                yield return LOWER_PIECE;
                yield return FULL_BODY;
                yield return GLOVES;
                yield return FEET;
                yield return SHIELD;
                yield return SIGIL;
                yield return UNDERWEAR;
                yield return CLOAK;
                yield return RING;
                yield return EARRING;
                yield return NECKLACE;
                yield return BELT;
                yield return BRACELET;
                yield return HAIR_ACCESSORY;
                yield return POTION;
                yield return SCROLL_ENCHANT_WEAPON;
                yield return SCROLL_ENCHANT_ARMOR;
                yield return SCROLL_OTHER;
                yield return SOULSHOT;
                yield return SPIRITSHOT;
                yield return EMPTY41;
                yield return PET_EQUIPMENT;
                yield return PET_SUPPLIES;
                yield return CRYSTAL;
                yield return RECIPE;
                yield return CRAFTING_MAIN_INGRIDIENTS;
                yield return LIFE_STONE;
                yield return SOUL_CRYSTAL;
                yield return ATTRIBUTE_STONE;
                yield return WEAPON_ENCHANT_STONE;
                yield return ARMOR_ENCHANT_STONE;
                yield return SPELLBOOK;
                yield return GEMSTONE;
                yield return POUCH;
                yield return PIN;
                yield return MAGIC_RUNE_CLIP;
                yield return MAGIC_ORNAMENT;
                yield return DYES;
                yield return OTHER_ITEMS;
            }
        }
        public static ExItemType valueOf(int ordinal)
        {
            return Values.FirstOrDefault(type => type.getNum() == ordinal);
        }
    }
}
